#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
struct member
{
	char name[40];
	char job[40];
	char rank[40];
	int tele[20];
	char email[50];
};

void Add(struct member *);

int main(int argc, char *argv[]) {
	
	
	printf("欢迎使用本通讯录!\n");
	 System();
	 
	
	return 0;
}
void System()
{
	int x ; //用于记录用户的输入
	struct member list[100];
	
	while(1)
	{
		x=Select();
		
			if(x == 1)
		{
			int add=1;
			
			if(add == 1)
			Add(&list);
			break;
			
		}
		else if(x == 2)
		{
			Update(&list);
			break;
		}
		else if(x == 3)
		{
			Delete();
			break;
		}
		else if(x == 4)
		{	
			Inquire();
			break;
		} 
		else
		{
		printf("您输入的有问题，请重试！");
		continue;
		Select();
		}
	}
	
		
		
	
}
int Select()
{
	printf("请选择你需要的功能\n");
	printf("1.添加\n"); 
	printf("2.修改\n");
	printf("3.删除\n");
	printf("4.查看/查询\n");
	
	 int x;
	printf("请输入您的选择：");
	scanf("%d",&x);
	return x;
 } 
void Add(struct member *add)
{
	int x;
	
	while(1)
	{
		printf("请输入他的名字：\n");
		scanf("%c",&add[0].name);
		printf("是否继续？\n");
		
		while(1)
		{
			printf("1.继续\n");
			printf("2.返回上一步\n");
			scanf("%d",&x);
			if(x==1) break;
			if(x==2) break;
			else 
			{
				printf("您输入的有问题，请重试\n");
				continue;
			}
			
		}
		
		 
		printf("请在输入他的职务：\n");
		scanf("%c",&add[0].job);
		printf("是否继续？\n");
		
		while(1)
		{
			printf("1.继续\n");
			printf("2.返回上一步\n");
			scanf("%d",&x);
			if(x==1) break;
			if(x==2) break;
			else 
			{
				printf("您输入的有问题，请重试\n");
				continue;
			}
			
		}
		
	}
	 
	
	printf("请问是否保存？\n");
	printf("1.是\n");
	printf("2.否\n");
	scanf(""); 
	
}
void Update()
{
	printf("update");
}
void Delete()
{
	printf("delete");
}
void Inquire()
{
	printf("inquire");
}